package com.chz.SupermarketMS.service;


import com.chz.SupermarketMS.dao.PDetailsRepository;

import com.chz.SupermarketMS.entities.PDetails;
import com.chz.SupermarketMS.entities.SDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PDetailsService {

    @Autowired
    PDetailsRepository pDetailsRepository;

//    public  PDetails findByPDetailsId(long theId) {
//        return pDetailsRepository.findByPDetailsId(theId);
//    }


    public PDetails save(PDetails pDetails){
        return pDetailsRepository.save(pDetails);
    }

    public List<PDetails> getAll(){
        return pDetailsRepository.findAll();
    }



    public void delete(PDetails thePDetails) {
        pDetailsRepository.delete(thePDetails);
    }

    public PDetails findByPdId(long theId) {
        return pDetailsRepository.findByPdId(theId);
    }


//       public void delete(PDetails thePDetails) {
//        PDetailsRepository.delete(thePDetails);
//    }
}
